<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MessageQuery
 *
 * @author juwking
 */
class MessageQuery extends TableControl {

    protected $user = 'root', $password, $dbase = 'wincon_mailing_db';

    function __construct() {
        parent::__construct();
    }

    function Select($param=null, $limit=null) {
        if (!is_int($param))
            $queryString = "Select * from message where message_id like :message_id and message_users_id like :message_users_id '";
        else {
            $queryString = "Select * from message LIMIT " . $param . ',' . $limit;
        }
        $result = $this->pdo->query($queryString);
        $result->setFetchMode(PDO::FETCH_ASSOC);
        return $result->fetchAll();
    }

    function Insert($param) {
        $this->initPDO();
        $queryString = "INSERT INTO message (message_users_id,message_mail_type_id,message_path) VALUES (:message_users_id,:message_mail_type_id,:message_path)";
        $stmt = $this->pdo->prepare($queryString);
        $stmt->bindParam(':message_users_id', $param['message_users_id']);
        $stmt->bindParam(':message_mail_type_id', $param['message_mail_type_id']);
        $stmt->bindParam(':message_path', $param['message_path']);
        $stmt->execute();
    }

    function Update($param) {

    }

    function Delete($param) {

    }

    function getEmptyRecord() {

    }

    public function getTableName() {
        return 'message';
    }

    public function getColumns() {
        return array('message_id', 'message_mailque_id', 'message_users_id', 'message_mail_type_id', 'message_path');
    }

}

?>
